package com.itcast.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itcast.mapper.OperateLogMapper;
import com.itcast.pojo.OperateLog;
import com.itcast.pojo.PageResult;
import com.itcast.service.OperateLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OperateLogServiceImpl implements OperateLogService {
    @Autowired
    private OperateLogMapper operateLogMapper;
    /*
    * 查询日志操作
    * */
    @Override
    public PageResult<OperateLog> selectOperateLog(Integer page, Integer pageSize) {
        //设置分页参数
        PageHelper.startPage(page,pageSize);
        //获取记录数

       List<OperateLog> logList = operateLogMapper.selectOperateLog();

       Page<OperateLog> pageResult = (Page<OperateLog>) logList;

        return new PageResult<>(pageResult.getTotal(),pageResult.getResult());
    }
}
